package com.net.common.util;

import java.util.Objects;

/**
 * @author  on 04/02/2018.
 * 手机号格式：
 * +
 */
public class PhoneUtil {
    private static final int MOBILE_LENGTH = 11;

    public static boolean isEffectiveMobile(String mobile) {
        if (mobile == null || mobile.length() != MOBILE_LENGTH) {
            return false;
        }
        if (!Objects.equals("1", mobile.substring(0, 1))) {
            return false;
        }
        int length = mobile.length();
        for (int i = 0; i < length; i++) {
            char ch = mobile.charAt(i);
            if (!Character.isDigit(ch)) {
                return false;
            }
        }

        return true;
    }
}
